package com.zcc.lesson02.utils;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

public class ExecuteUpdateUtils {
    public static void deleteTest(String sql,int pi,int x) {
        Connection conn=null;
        PreparedStatement ps=null;
        try {
            conn = JDBCUtils.getConnection();
            ps = conn.prepareStatement(sql);
            ps.setInt(pi,x);
            int i = ps.executeUpdate();
            if (i > 0) {
                System.out.println("删除成功！");
            }
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }finally {
            JDBCUtils.release(conn,ps,null);
        }
    }
}
